@extends('admin.layouts')
@section('content')
    <!--面包屑导航 开始-->
    <div class="crumb_warp">
        <!--<i class="fa fa-bell"></i> 欢迎使用登陆网站后台，建站的首选工具。-->
        <i class="fa fa-home"></i> <a href="#">首页</a> &raquo; 配置项管理
    </div>
    <!--面包屑导航 结束-->

	<!--结果集标题与导航组件 开始-->
    <div class="result_wrap">
        <div class="result_wrap">
            <div class="result_title">
                <h3>修改配置项</h3>
                <div class="mark">
                    @if(is_object($errors))
                        @if(count($errors)>0)
                            @foreach($errors->all() as $error)
                                {{$error}}
                            @endforeach
                        @endif
                    @else
                        <p>{{$errors}}</p>
                    @endif
                </div>
            </div>
            <div class="result_content">
                <div class="short_wrap">
                    <a href="{{url('admin/config/create')}}"><i class="fa fa-plus"></i>添加配置项</a>
                    <a href="{{url('admin/config')}}"><i class="fa fa-recycle"></i>全部配置项</a>
                </div>
            </div>
        </div>
    <!--结果集标题与导航组件 结束-->

    <div class="result_wrap">
        <form action="{{url('admin/config/'.$field->conf_id)}}" method="post">
            <input type="hidden" name="_method" value="put">
            {{csrf_field()}}
            <table class="add_tab">
                <tbody>
                    <tr>
                        <th><i class="require">*</i>名称</th>
                        <td>
                            <input type="text" name="conf_name" value="{{$field->conf_name}}">
                            <span><i class="fa fa-exclamation-circle yellow"></i>配置项名称必须填写</span>
                        </td>
                    </tr>
                    <tr>
                        <th><i class="require">*</i>标题</th>
                        <td>
                            <input type="text" name="conf_title" value="{{$field->conf_title}}">
                            <span><i class="fa fa-exclamation-circle yellow"></i>配置项标题必须填写</span>
                        </td>
                    </tr>
                    <tr>
                        <th>类型</th>
                        <td>
                            <input type="radio" name="field_type" value="input" @if($field->field_type=='input') checked @endif onclick="showTr()">input &nbsp;&nbsp;
                            <input type="radio" name="field_type" value="textarea" @if($field->field_type=='textarea') checked @endif onclick="showTr()">textarea &nbsp;&nbsp;
                            <input type="radio" name="field_type" value="radio" @if($field->field_type=='radio') checked @endif onclick="showTr()">radio &nbsp;&nbsp;
                        </td>
                    </tr>
                    <tr class="field_value">
                        <th>类型值</th>
                        <td>
                            <input type="text" class="lg" name="field_value" value="{{$field->conf_value}}">
                            <p><i class="fa fa-exclamation-circle yellow"></i>当类型radio时填写此字段, 格式：1|开启，0|关闭</p>
                        </td>
                    </tr>
                    <tr>
                        <th>描述</th>
                        <td>
                            <textarea class="lg" name="conf_tips">{{$field->conf_tips}}</textarea>
                        </td>
                    </tr>
                    <tr>
                        <th>排序</th>
                        <td>
                            <input type="text" class="sm" name="conf_order" value="{{$field->conf_order}}">
                        </td>
                    </tr>
                    <tr>
                        <th></th>
                        <td>
                            <input type="submit" value="提交">
                            <input type="button" class="back" onclick="history.go(-1)" value="返回">
                        </td>
                    </tr>
                </tbody>
            </table>
        </form>
    </div>
        <script>
            showTr();
            function showTr() {
                var type = $('input[name=field_type]:checked').val();
                if(type=='radio'){
                    $('.field_value').show();
                }else{
                    $('.field_value').hide();
                }
            }
        </script>
@endsection
